export { default as Axios } from "./Axios";

export interface IResData<T> {
  records: any;
  code: number;
  success: boolean;
  data: T;
  msg: string;
}

export interface IResListData<T> {
  records: T;
  total: number;
  size: number;
  current: number;
  pages: number;
  searchCount: boolean;
  hitCount: boolean;
}
export function safeParseJSON(jsonString, defaultValue = {}) {
  try {
    return JSON.parse(jsonString);
  } catch (error) {
    console.error("Error parsing JSON:", error);
    return defaultValue;
  }
}
export const filterPage = (key) => {
  switch (key) {
    case 'activity':
      return "/communityActivities?type=activities"
    case 'employ':
      return "/communityActivities?type=guidance"
    case 'business':
      return "/communityActivities?type=support"
    case 'information':
      return "/communityInformation?type=info"
    case 'policy':
      return "/communityInformation?type=unscramble"
    case 'handleAffairs':
      return "/communityInformation?type=guide"
    case 'propagate':
      return "/communityInformation?type=disseminate"
    case 'communityInfo':
      return "/myCommunity"
    case 'lifeCircle':
      return "/lifeCircle"
    case 'service':
      return "/communityService"
    case 'party':
      return "/smartPartyBuilding"
    case 'govern':
      return "/intelligentGovernance"
    case 'message':
      return "/messege"
    case 'userInfo':
      return "/user"
    default:
      return '/'
  }
};
